package mryao.tree;

public class treeNode<E> {
    private E data;
    private treeNode left;
    private treeNode right;

    public treeNode(){
    }

    public treeNode(E data) {
        this.data = data;
        this.left = null;
        this.right = null;
    }

    public treeNode(E data, treeNode left, treeNode right) {
        this.data = data;
        this.left = left;
        this.right = right;
    }

    @Override
    public String toString() {
        return this.data.toString();
    }

    public boolean hasLeft(){
        return this.left != null;
    }

    public boolean hasRight(){
        return this.right != null;
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }

    public treeNode getLeft() {
        return left;
    }

    public void setLeft(treeNode left) {
        this.left = left;
    }

    public treeNode getRight() {
        return right;
    }

    public void setRight(treeNode right) {
        this.right = right;
    }
}
